{% extends "include/base.html" %}
{% block title %}Изменение пароля{% endblock %}

{% block content %}
  {% load user_filters %}
  <div class="row justify-content-center">
    <div class="col-md-8 p-5">
      <div class="card">
        <div class="card-header">Изменить пароль</div>
        <div class="card-body">

          {% if form.errors %}
            {% for field in form %}
              {% for error in field.errors %}
                <div class="alert alert-danger" role="alert">
                  {{ field.label }}: {{ error|escape }}
                </div>
              {% endfor %}
            {% endfor %}
          {% endif %}

          <form method="post">
            {% csrf_token %}

            {% for field in form %}
              <div class='form-group row'
                   aria-required={% if field.field.required %}'true'
                   {% else %}'false'{% endif %}>
                <label for='{{ field.id_for_label }}'
                       class='col-md-4 col-form-label text-md-right'>
                  {{ field.label }}{% if field.field.required %}
                    <span class='required'>*</span>{% endif %}
                </label>
                <div class='col-md-6'>
                  {{ field|addclass:'form-control' }}
                  {% if field.help_text %}
                    <small id='{{ field.id_for_label }}-help'
                           class='form-text text-muted'>
                      {{ field.help_text|safe }}
                    </small>
                  {% endif %}
                </div>
              </div>
            {% endfor %}

            <div class="col-md-6 offset-md-4">
              <button type="submit" class="btn btn-primary">
                Изменить пароль
              </button>
            </div>
          </form>

        </div> <!-- card body -->
      </div> <!-- card -->
    </div> <!-- col -->
  </div> <!-- row -->

{% endblock %}